package com.ldp.designpatterns.study.builder.director;

import com.ldp.designpatterns.study.builder.abstractBuilder.HouseBuilder;
import com.ldp.designpatterns.study.builder.product.House;

/**
 * @ClassName Director
 * @Description TODO: 建造者模式——4、指导者（Director）：负责控制建造的过程。它通过将客户端与具体建造者分离，确保产品的构建是按照一定顺序和规则进行的。
 * @Author lindipei
 * @Date 2023/10/17 15:23
 */
public class Director {
    private HouseBuilder builder;

    public Director(HouseBuilder builder) {
        this.builder = builder;
    }

    public House constructHouse() {
        builder.buildFoundation();
        builder.buildStructure();
        builder.buildRoof();
        builder.buildInterior();
        return builder.getHouse();
    }
}
